﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SEOBlog.Web.Helpers;

namespace Tools
{
    public class Page : INode
    {
        public string Id { get; set; }

        public string ParentId { get; set; }

        public string Name { get; set; }

        public override string ToString()
        {
            return Name;
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            /*HtmlToJsonString util = new HtmlToJsonString();
            util.Run("Views", "Result");*/

            var root = new List<TreeNode<Page>>
                           {
                               new TreeNode<Page> {Data = new Page {Id = "1", Name = "First"}},
                               new TreeNode<Page> {Data = new Page {Id = "2", Name = "Second"}}
                           };

            var tree = new NaryTree<Page>(root );

            tree.Add(new Page{Id = "3", ParentId = "1", Name = "A"});
            tree.Add(new Page{Id = "4", ParentId = "1", Name = "B"});
            tree.Add(new Page {Id = "5", ParentId = "1", Name = "C"});
            tree.Add(new Page{Id = "6", ParentId = "4", Name = "D"});
            tree.Add(new Page{Id = "7", ParentId = "4", Name = "E"});
            tree.Add(new Page{Id = "8", ParentId = "2", Name = "F"});

            string res = tree.TraverseTree(Console.WriteLine, Console.WriteLine);
        }
    }
}
